package cn.com.headfree.mouldshow.dao.impl;

import cn.com.headfree.entity.TSdtAwardTemp;
import cn.com.headfree.mouldshow.dao.TSdtAwardTempDao;
import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Repository("/tSdtAwardTempDao")
public class TSdtAwardTempDaoImpl extends BaseDaoImpl<TSdtAwardTemp> implements TSdtAwardTempDao {


    @Override
    public void saveInfo(TSdtAwardTemp tSdtAwardTemp) {
        String sql = "insert into t_sdt_award_temp (id,item_type,item_id,award,sdt_td_id,org_id,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,orignal_id) values ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{item_type,jdbcType=VARCHAR},")
                .append("#{item_id,jdbcType=VARCHAR},").append("#{award,jdbcType=VARCHAR},")
                .append("#{sdt_td_id,jdbcType=VARCHAR},").append("#{org_id,jdbcType=VARCHAR},")
                .append("#{creater_id,jdbcType=VARCHAR},")
                .append("#{creater_name,jdbcType=VARCHAR},").append("#{create_time,jdbcType=DATE},")
                .append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
                .append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
                .append("#{orignal_id,jdbcType=VARCHAR})");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tSdtAwardTemp.getId());
        params.put("item_type", tSdtAwardTemp.getItemType());
        params.put("item_id", tSdtAwardTemp.getItemId());
        params.put("award", tSdtAwardTemp.getAward());
        params.put("sdt_td_id", tSdtAwardTemp.getSdtTdId());
        params.put("org_id", tSdtAwardTemp.getOrgId());
        params.put("creater_id", tSdtAwardTemp.getCreaterId());
        params.put("creater_name", tSdtAwardTemp.getCreaterName());
        params.put("create_time", new Timestamp(new Date().getTime()));
        params.put("updater_id", tSdtAwardTemp.getUpdaterId());
        params.put("updater_name", tSdtAwardTemp.getUpdaterName());
        params.put("update_time", new Timestamp(new Date().getTime()));
        params.put("del_sign", 0);
        params.put("orignal_id", tSdtAwardTemp.getOrignalId());
        this.executeSql(sqlBuilder.toString(), params);
    }
}
